<?php
	/**
	* Video manager Edit page
	* @author trungdt
	* @since Oct 26, 2011 
	* 
	* Change logs
	* 
	*/

	if (!defined('EXPONENT')) exit('');
	
	$video = null;
	$config=null;
	if (isset($_GET['id'])) {
		$video = $db->selectObject('videomodule_video','id='.intval($_GET['id']));
		if ($video) {
			$loc = unserialize($video->location_data);
		}
	}
	
	if (exponent_permissions_check(array('administrate','configure', "create", "edit"),$loc)) {
		$form = videomodule_video::video_form($video, $loc);
		$form->location($loc);
		$form->meta('action','video_save');

		$template = new template('videomodule','_video_edit');
		$template->assign('is_edit',(isset($video->id)? 1 : 0));
		$template->assign('form_html',$form->toHTML());
		$template->output();
	} else {
		echo exponent_http_error(403);
	}

?>